package com.qidian.permission.controller;

import com.qidian.permission.service.PermissionService;
import com.qidian.permission.util.entity.PerResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 戴着假发的程序员
 * @Company 起点编程
 * @Time 2023/10/19 15:31
 * @Description
 */
@CrossOrigin
@RestController
@RequestMapping("/permission")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @GetMapping("/list")
    public PerResult list(){

        return permissionService.selectAll();
    }

    @GetMapping("/queryByUserId")
    public PerResult queryByUserId(Long userId){
        return permissionService.queryByUserId(userId);
    }

    @GetMapping("/settingUserPermission")
    public PerResult settingUserPermission(Long userId,Long [] permissionId){
        return permissionService.settingUserPermission(userId,permissionId);
    };
}
